import request from "@/utils/request";

/**
 * 注册
 */
export function register(data) {
  return request({ method: "post", url: "/ats/user/register", data });
}

/**
 * 登录
 */
export function login(data) {
  return request({ method: "post", url: "/ats/user/login", data });
}

/**
 * 获取当前登录用户的信息
 */
export function me() {
  return request({ method: "get", url: "/ats/user/info" });
}

/**
 * 分页获取用户信息
 */
export function page(data) {
  return request({ method: "get", url: "/ats/user/page", data });
}

/**
 * 修改用户信息
 */
export function update(data) {
  return request({ method: "post", url: "/ats/user/update", data });
}

export function add(data) {
  return request({ method: "post", url: "/ats/user/add", data });
}

export function getById(id) {
  return request({
    method: "get",
    url: `/ats/user/getById?id=${id}`,
  });
}

export function deleteByIds(data) {
  return request({
    method: "post",
    url: "/ats/user/delete",
    data,
  });
}

/**
 * 根据旧密码修改密码
 */
export function changePwd(data) {
  return request({ method: "post", url: "/ats/user/changePwd", data });
}


/**
 * 根据密码修改密保
 */
export function changeAnswer(data) {
  return request({ method: "post", url: "/ats/user/changeAnswer", data });
}

/**
 * 根据密保重置密码
 */
export function resetPwd(data) {
  return request({ method: "post", url: "/ats/user/resetPwd", data });
}

/**
 * 上传头像
 */
export function uploadHeadImage(data) {
  return request({
    method: "post",
    url: "/ats/user/uploadHeadImage",
    data,
  });
}
